// hyb_yl/doctorHome/pages/time_axis/time_axis.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list:[],
    page:0,
    j_id:"",
    zid:"",
    id:"",
    type:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var j_id = options.j_id;
    var that = this;
    var id = options.id;
    var zid = options.zid;
    that.setData({
      zid:zid,
      j_id:j_id,
      id:id,
      names:options.names,
      sex:options.sex,
      age:options.age,
      u_thumb:options.u_thumb,
      type:options.type
    })
    that.getList();
  },
  touser:function(e){
    var that = this;
    var id = that.data.id;
    var zid = that.data.zid;
    var j_id = that.data.j_id;
    var names = that.data.names;
    var sex = that.data.sex;
    var age = that.data.age;
    var u_thumb = that.data.u_thumb;
    wx.navigateTo({
      url: '/hyb_yl/doctorHome/pages/task_data/task_data?id=' + id+'&zid='+zid+'&j_id='+j_id+'&names='+names+'&sex='+sex+'&age='+age+'&u_thumb='+u_thumb,
    })
  },
  getList:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/follow.all_suifang",
      data:{
        j_id:that.data.j_id,
        id:that.data.id,
        zid:that.data.zid,
        page:that.data.page
      },
      success:function(res)
      {
        that.setData({
          list:that.data.list.concat(res.data),
          page:that.data.page + 1
        })
      }
    })
  },
  todetail: function (e) {
    var that = this;
    var id = e.currentTarget.dataset.id;
    if(that.data.type == 'edit')
    {
      wx.navigateTo({
        url: '/hyb_yl/doctorHome/pages/task_edit/task_edit?id=' + id,
      })
    }else if(that.data.type == 'see')
    {
      wx.navigateTo({
        url: '/hyb_yl/huanzhe/pages/plan_detail/plan_detail?id=' + id+'&type=see',
      })
    }
    
  },
  edit:function(e){
    var that = this;
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/hyb_yl/doctorHome/pages/task_edit?id='+id,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    this.getList();
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})